require 'mime/types'

class Photo < ActiveRecord::Base
  belongs_to :album

  def self.per_page
    18
  end
  
  has_attachment :content_type => :image,
    :storage => :file_system,
    :path_prefix => 'public/albums',
    :max_size => 2.megabytes,
    #    :partition => false,
    :resize_to => '640x360>',
    :thumbnails => { :thumb =>  '50x50', :list => '100x75', :big => '553x415' }

  def swf_uploaded_data=(data)
    data.content_type = MIME::Types.type_for(data.original_filename)
    self.uploaded_data = data
  end

  validates_as_attachment

end
